package edu.sctu.wangxiaoqiang.day20150614.Reader;


import java.io.*;

/**
 * Created by user25 on 2015/6/14.
 */
public class Reader {

//    public void reader(){
//        int num = 0;
//        char[] chars = new char[10];
//        try {
//            InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream("D:\\GHF.txt"));
//            FileOutputStream fileOutputStream = new FileOutputStream(new File("D:\\Wildlife_1.txt"));
//            try {
//                while ((num = inputStreamReader.read(chars)) !=-1){
//                    System.out.println(chars);
//                    fileOutputStream.write((char)num);
//                }
//
//
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
//
//
//    }

    public void Reader1(){
        int number = 0;
        char[] ch = new char[10];
        try {
            FileReader fileReader = new FileReader(new File("D:\\DFD.txt"));
            FileWriter fileWriter = new FileWriter(new File("D:\\SSS.TXT"));
                try {
                    while ((number = fileReader.read(ch)) != -1){
                        System.out.println(ch);
                       fileWriter.write(ch,0,number);
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    fileReader.close();
                    fileWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
